//
//  JYBaseRegHeaderView.m
//  MYCCBRegisterSubAccount
//
//  Created by 应明顺 on 2018/7/5.
//  Copyright © 2018年 JackYing. All rights reserved.
//

#import "JYBaseHeaderView.h"

@interface JYBaseHeaderView () {
    UILabel *title;
    UILabel *subTitle;
}

@end

@implementation JYBaseHeaderView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithReuseIdentifier:reuseIdentifier]) {
//        UIView *bgView = [[UIView alloc] init];
//        bgView.backgroundColor = [UIColor whiteColor];
        self.contentView.backgroundColor = [UIColor whiteColor];
        title = [[UILabel alloc] init];
        title.textAlignment = NSTextAlignmentCenter;
        title.font = [UIFont boldSystemFontOfSize:22];
        [self.contentView addSubview:title];
        
        subTitle = [[UILabel alloc] init];
        subTitle.textAlignment = NSTextAlignmentCenter;
        subTitle.font = [UIFont systemFontOfSize:18];
        subTitle.textColor = [UIColor grayColor];
        [self.contentView addSubview:subTitle];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    CGRect frame = self.frame;
    CGFloat height = CGRectGetHeight(frame)/4;
    CGFloat width = CGRectGetWidth(frame);
    title.frame = CGRectMake(0, height, width, height);
    subTitle.frame = CGRectMake(0, height * 2, width, height);
}

- (void)setHeaderModel:(JYBaseHeaderModel *)headerModel {
    
    if (_headerModel != headerModel) {
        _headerModel = headerModel;
    }
    title.text = _headerModel.title;
    subTitle.text = _headerModel.subTitle;    
}

@end
